# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=asuran-cli
pkgver=0.1.6
pkgrel=2
pkgdesc="Asuran is a new archive format and rust implementation"
url="https://gitlab.com/asuran-rs/asuran"
arch="all !s390x !riscv64"
license="BSD-2-Clause-Patent"
# TODO: Replace openssl1.1-compat-dev with openssl-dev after upgrade
makedepends="cargo openssl1.1-compat-dev"
source="https://gitlab.com/asuran-rs/asuran/-/archive/v$pkgver/asuran-v$pkgver.tar.gz"
builddir="$srcdir/asuran-v$pkgver"

build() {
	local _rf=
	local _f=
	case "$CARCH" in
		x86_64)	  _rf="-C target-feature=+aes $_rf" ;;
		aarch64*) _rf="-C target-feature=+aes $_rf"
			  _f="--features blake3-neon" ;;
	esac

	export RUSTFLAGS=$_rf

	cd asuran-cli
	cargo build --release --locked $_f
}

check() {
	cargo test all --release --locked
}

package() {
	cd asuran-cli
	cargo install --locked --path . --root="$pkgdir/usr"
	rm "$pkgdir"/usr/.crates.toml
	rm "$pkgdir"/usr/.crates2.json
}

sha512sums="2345b9ad0daedc4b21707bcdae72f7678f8e8d7adb470f78088ceb88f8ca18d1661bc5126d6199d5e904b528c7b5b50e9f8c3d770b28b72fcad64c17e9b87add  asuran-v0.1.6.tar.gz"
